<!DOCTYPE html>
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>商品详情  - {php echo $this->module['config']['sname']}</title>
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, user-scalable=no, width=device-width">
	<meta content="telephone=no" name="format-detection">
    <link href="{WELIAM_INDIANA_STATIC}css/common.css" rel="stylesheet">
    <link href="{WELIAM_INDIANA_STATIC}css/detail.css" rel="stylesheet">
    <link href="{WELIAM_INDIANA_STATIC}css/member.css" rel="stylesheet">
   	<script language="javascript" src="{WELIAM_INDIANA_STATIC}js/jquery.js"></script>
    <script language="javascript" src="{WELIAM_INDIANA_STATIC}js/swipe.js"></script>
    <script type='text/javascript' src='{WELIAM_INDIANA_STATIC}js/laytpl.js' charset='utf-8'></script>
    <style>.item{display: inline-block;width: 80px;}</style>
</head>
{php echo register_jssdk();}
<script>
	//微信分享
	var title = "{$detail_goodslist['title']}";
	var imgUrl = "{php echo tomedia($detail_goodslist['picarr'])}";
	var desc = "{if $detail_goodslist['init_money'] == 10}10{else}1{/if}元拿{$detail_goodslist['title']}，机会不容错过！";
	
	wx.ready(function(){
		wx.onMenuShareTimeline({
   			title: title, // 分享标题
    		imgUrl: imgUrl, // 分享图标
    	success: function () { 
        // 用户确认分享后执行的回调函数
        	alert('分享成功');
   		},
    	cancel: function () { 
        // 用户取消分享后执行的回调函数
       		alert("分享失败");
    	}
	});

//分享给好友
	wx.onMenuShareAppMessage({
    		title: title, // 分享标题
   			 desc: desc, // 分享描述
    		imgUrl: imgUrl, // 分享图标
    	success: function () { 
        // 用户确认分享后执行的回调函数
         	alert('分享成功');
    	},	
    	cancel: function () { 
        // 用户取消分享后执行的回调函数
        	 alert('分享失败');
    	}
		});
	});
	
	function ch_button(){
		var butt = document.getElementById('ch_button');
		if(butt.style.display == 'none'){
			butt.style.display = 'block';
		}else{
			butt.style.display = 'none';
		}
	}
</script>
<body class="webkit chrome">
<div class="g-body">
    <div class="m-detail">
	<div class="m-simpleHeader" id="dvHeader">
		<a href="javascript:history.back(-1);" data-pro="back" data-back="true" class="m-simpleHeader-back"><i class="ico ico-back"></i></a>
	    <h1>奖品详情</h1>
	</div>
	<!-- ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓顶部栏开始↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ -->
    <div class="m-detail-menu open">
        <a id="moreBtn" href="javascript:ch_button()"><i class="ico ico-more"></i><i class="ico ico-dot" style="display:none"></i></a>
        <div class="m-detail-menu-wrap" id="ch_button"  style="display: none;">
            <i class="ico ico-arrow ico-arrow-transGray"></i>
            <ul class="m-detail-menu-list">
                <li>
                	<a class="item" href="{php echo $this->createMobileUrl('cart',array('op'=>'cart_detail'));}">
					  <span class="miniCart">
					      <span class="w-miniCart-text"></span>
					      <i class="ico ico-miniCart ico-miniCart-gray"></i>
					      <b class="w-miniCart-count" data-pro="count" style="left:80px;top:10px;background:red">{php echo m('goods')->getCartNumber(m('user')->getOpenid())}</b>
					  </span>
					  清单
					</a>
                </li>
                
                <li class="last">
                	<a class="item" href="{php echo $this->createMobileUrl('index')}">
                		<i class="ico ico-home ico-home-light"></i>首页</a>
                </li>
                
            </ul>
        </div>
    </div>
    <!-- ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑顶部栏结束↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ -->
    {template 'followed'}    
        <div class="g-wrap">
            <div class="g-wrap-hd">
            	<!-- ↓↓↓↓↓幻灯片开始↓↓↓↓↓ -->
            	{if $advs}
            	<div id="banner_box" class="box_swipe">
					<ul>
						{loop $advs $adv}
						<li>
							<a href="{if empty($adv['link'])}#{else}{$adv['link']}{/if}">
								<img src="{php echo tomedia($adv['thumb']);}" style='width:100%;' />
							</a>
		
						</li>
						{/loop}
					</ul>
					<ol>
						{php $slideNum = 1;} {loop $advs $adv}
						<li{if $slideNum==1 } class="on" {/if}></li>
							{php $slideNum++;} {/loop}
					</ol>
				</div>
				<script>
					$(function() {
				        new Swipe($('#banner_box')[0], {
				            speed:500,
				            auto:3000,
				            callback: function(){
				                var lis = $(this.element).next("ol").children();
				                lis.removeClass("on").eq(this.index).addClass("on");
				            }
				        });
				    });
				</script>
				{else}
                <div class="w-slide m-detail-show" id="pro-view-1">
                    <div class="w-slide-wrap">
                        <ul class="w-slide-wrap-list" data-pro="list" style="width: 500%;">
                        	<li data-pro="item" class="w-slide-wrap-list-item selected">
                                <img src="{$period['goods_picture']}">
                            </li>
                        </ul>
                    </div>
                    <div class="w-slide-controller">
                        <div class="w-slide-controller-nav" data-pro="controllerNav">
                        <span class="dot curr"></span>
                        </div>
                    </div>
                </div>
                {/if}
                <!-- ↑↑↑↑↑幻灯片结束↑↑↑↑↑ -->
                <!-- ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓商品信息开始↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ -->
                <div class="w-goods w-goods-xxl m-detail-goods">
                    <div class="w-goods-info">
                        <p class="w-goods-title">(第{$period['periods']}期){$period['title']}</p>
                        <p class="w-goods-price">总需：{$period['zong_codes']} 人次</p>
                        {if $period['status'] == 1}
                        <!-- ↓↓↓↓↓商品未揭晓开始↓↓↓↓↓ -->
                        <div class="w-progressBar">
                            <p class="wrap">
                                <span class="bar"><i class="color" style="width:{if $period['scale']}{$period['scale']}{else}0{/if}%;"></i></span>
                            </p>
                            <ul class="txt">
                                <li class="txt-l"><p>已参与<b>{$period['canyurenshu']}</b>人次</p></li>
                                <li class="txt-r"><p>剩余<b class="txt-blue">{$period['shengyu_codes']}</b></p></li>
                            </ul>
                        </div>
                        <!-- ↑↑↑↑↑商品未揭晓结束↑↑↑↑↑ -->
                        {elseif $period['endtime'] !='' && $period['endtime'] > $period['nowtime']}
                        <!-- ↓↓↓↓↓商品正在揭晓开始↓↓↓↓↓ -->
                        <div class="m-detail-goods-countdown">
                            <div class="w-countdown" time="597135">
                                <span class="w-countdown-title">揭晓倒计时</span>
                                <span class="w-countdown-nums"></span>
                                <span class="w-countdown-waiting" style="display:none"><b>正在计算...</b></span>
                            </div>
                            <a class="resultBtn w-button w-button-simple w-button-simple-white" href="#">待计算结果</a>
                        </div>
                        <script>
						$(document).ready(function(){
						    function FreshTime(){
						        var str ='{php echo date('Y-m-d H:i:s',$period['endtime'])}';
						        str = str.replace(/-/g,"/");
						        var starttime= new Date(str);//开始时间
						        var nowtime = new Date();//当前时间
						        var now_time = parseInt(nowtime.getTime());
						        var start_time = parseInt(starttime.getTime());
						        var jiexiao_time = start_time;
						        var lefttime = (jiexiao_time-now_time)/1000;
						       if (lefttime > 0) {
						            mm=parseInt((lefttime/60)%60);
						            if(10>mm>0){
						            	mm="0"+mm;
						            }
						            ss=(lefttime%60).toFixed(2);
						            if(10>parseInt(ss)>0){
						            	ss="0"+ss;
						            }
						            $(".w-countdown-nums").html(mm+":"+ss);
						        }else{
						            $(".m-detail-goods-countdown").remove();
						            $(".m-detail-goods-result").show();
						            return false;
						        }
						  	}
						    FreshTime();
						    var sh;
						    sh=setInterval(FreshTime,10);
						});
						</script>
						 <!-- ↑↑↑↑↑商品正在揭晓结束↑↑↑↑↑ -->
						{/if}
						
                        {if $period['status'] > 1 && ($period['endtime'] !='' && $period['nowtime'] > $period['endtime'])}
                        <!-- ↓↓↓↓↓商品中奖信息开始↓↓↓↓↓ -->
                        <div class="m-detail-goods-result" {if $period['status'] == 2} style="display: none;"{/if}>
                            <div class="w-record">
                                <i class="ico ico-label ico-label-winner"></i>
                                <div class="w-record-avatar">
                                    <a href="#"><img width="90" height="90" src="{$period['avatar']}">
</a>
                                </div>
                                <div class="w-record-detail">
                                    <p class="f-breakword">获奖者：<a href="#">{$period['nickname']}</a></p>
                                    <p>揭晓时间：{php echo date('Y-m-d H:i:s',$period['endtime'])}</p>
                                    <p>本期参与：{$period['partakes']}人次　<a class="m-detail-userCodes-viewWinnerCodesBtn" href="javascript:;" onclick="getMoreRecru('{$period['period_number']}','{$period['openid']}')">查看Ta的号码</a></p>
                                </div>
                            </div>
                            <p class="m-detail-goods-result-luckyCode">幸运号码：<b>{$period['code']}</b><a class="resultBtn w-button w-button-simple w-button-simple-white" href="{php echo $this->createMobileUrl('result', array('id' => $period['id']))}">查看计算详情</a></p>
                        </div>
                        <!-- ↑↑↑↑↑商品中奖信息结束↑↑↑↑↑ -->
                        {/if}
                    </div>
                </div>
				<!-- ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑商品信息结束↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ -->
				<!-- ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓我的参与情况开始↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ -->
                <div class="m-detail-userCodes">
                	{if $mycodes}
                	<p>您参与了：<span class="txt-red">{$mycodes['count']}</span>人次</p><p class="codes">夺宝号码：
                		{loop $mydelcodes $codes}
                		<b {if $period['status']>2 && $period['code']==$codes}class="txt-red"{/if}>{$codes}</b>
                		{/loop}
						{if $mycodes['count'] > 6}
                		<a class="m-detail-userCodes-viewCodesBtn" href="javascript:;" onclick="getMoreRecru('{$period['period_number']}','{$_W['openid']}')">查看全部</a>
                		{/if}
                	</p>
                	{else}
                	<p class="m-detail-userCodes-blank">您没有参与本次夺宝哦！</p>
                	{/if}
                </div>
                <!-- ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑我的参与情况结束↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ -->
            </div>
            
            {$couponmess}
            
            <div class="g-wrap-bd">
                <div class="m-detail-more">
                    <a href="{php echo $this->createMobileUrl('detail', array('id' => $period['goodsid'],'op' => 'detail'))}" class="w-bar">图文详情 <span class="w-bar-hint">( 建议在wifi下查看 )</span><span class="w-bar-ext"><b class="ico-next"></b></span></a>
                    <a href="{php echo $this->createMobileUrl('past', array('id' => $period['goodsid']))}" class="w-bar">往期揭晓<span class="w-bar-ext"><b class="ico-next"></b></span></a>
                    <a href="{php echo $this->createMobileUrl('goodsshare', array('goodsid' => $period['goodsid']))}" class="w-bar">晒单分享<span class="w-bar-ext"><b class="ico-next"></b></span></a>
                    <a href="javascript:void(0)" onclick="$('.pro-mask').show();$('.w-msgbox').show();" class="w-bar">幸运码计算方式<span class="w-bar-ext"><b class="ico-next"></b></span></a>
                </div>
                <div class="m-detail-record">
                    <div class="w-bar">所有参与记录 <span class="w-bar-hint">(自{php echo date('Y-m-d H:i:s',$period['createtime'])}开始)</span></div>
                    <div class="m-detail-record-wrap">
                    <div id="pro-view-4">
                    <ul class="m-detail-record-list" data-pro="entry" id="dataList">
                    	<!-- ↓↓↓↓↓购买记录信息开始↓↓↓↓↓ -->
                    	
                    	<!-- ↑↑↑↑↑购买记录信息结束↑↑↑↑↑ -->
                    </ul>
                    <div data-pro="more">
	                    <div class="w-more" id="pro-view-13">
	                        <div data-pro="link" id="refresh">上拉、试试 </div>                   
	                    </div>
	                </div>
                   </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{if $period['status']==1}
<div class="m-simpleFooter m-detail-buy">
    <div data-pro="text" class="m-simpleFooter-text" style="text-align:center">
            <a id="quickBuy" class="w-button w-button-main" href="{php echo $this->createMobileUrl('cart', array('op' => 'cart_detail','opp'=>'rightnow','periodnumber'=>$period['period_number'],'title'=>$detail_goodslist['title']))}">立即参与</a>
            <a  class="w-button" id="addtocart" >加入清单</a>
    </div>
    <div data-pro="ext" class="m-simpleFooter-ext"></div>
</div>
{elseif $detail_goodslist['status'] == 2}
<div class="m-simpleFooter m-detail-go" style="display: block;">
    <div data-pro="text" class="m-simpleFooter-text">
        <span class="m-detail-go-period">最新一期</span>正在火热进行...
    </div>
    <div data-pro="ext" class="m-simpleFooter-ext">
        {if $detail_goodslist['status'] == 2}<a class="w-button w-button-main m-detail-go-link" href="{php echo $this->createMobileUrl('detail', array('id'=>$detail_goodslist['id']))}">立即前往</a>{/if}
    </div>
</div>
{else}
<div class="m-simpleFooter m-detail-buy">
    <div data-pro="text" class="m-simpleFooter-text" style="text-align:center">
        <a id="quickBuy" class="w-button w-button-main" href="#">商品已下架</a>
    </div>
    <div data-pro="ext" class="m-simpleFooter-ext"></div>
</div>
{/if}
<div class="pro-mask" id="pro-view-7" style="display: none;"></div>
<div class="w-msgbox" id="pro-view-5" style="left: 14px; top: 10%; display: none;">
	<div data-pro="close" class="w-msgbox-close" onclick="$('.pro-mask').hide();$('.w-msgbox').hide();">×</div>
	<div class="w-msgbox-bd"><h3 class="w-msgbox-title"></h3>
		<div style="font-size: 12px;">
			<p style="font-size: 13px; margin-bottom: 10px; font-weight: bold;">幸运号码计算方式：</p>
			<p style="margin-bottom: 10px;"><b>1.</b> 奖品的最后一个号码分配完毕后，将公示该分配时间点前本站全部奖品的最后20个参与时间；</p>
			<p style="margin-bottom: 10px;"><b>2.</b> 将这20个时间的数值进行求和（得出数值A）（每个时间按时、分、秒、毫秒的顺序组合，如20:15:25.362则为201525362）；</p>
			<p style="margin-bottom: 10px;"><b>3.</b> 为保证公平公正公开，系统还会等待一小段时间，取最近下一期中国福利彩票“老时时彩”的开奖结果（一个五位数值B）；</p>
			<p style="margin-bottom: 10px;"><b>4.</b> （数值A+数值B）除以该奖品总需人次得到的余数 + 原始数&nbsp;1000001，得到最终幸运号码，拥有该幸运号码者，直接获得该奖品。</p>
		</div>
	</div>
	<div data-pro="footer" class="w-msgbox-ft w-msgbox-ft-1" onclick="$('.pro-mask').hide();$('.w-msgbox').hide();"><button class="pro-btn" type="button" id="pro-view-6"><span>确定</span></button></div>
</div>

<button class="w-button w-button-round w-button-backToTop" style="display:none" id="prodibu">返回顶部</button>
</body>
{template 'common_message'}
<script>
	$("#addtocart").bind('click',function(){
		var periodnumber = "{$period['period_number']}";
		var title = "{$detail_goodslist['title']}";
		$.post("{php echo $this->createMobileUrl('cart',array('op'=>'tocart'))}",{periodnumber:periodnumber,title:title},function(d){
				if(d.result==1){
					tip("加入清单成功！",true);
				}
		},"json");
		
	});
</script>
<script language="javascript" src="{WELIAM_INDIANA_STATIC}js/jquery.js"></script>
<script type="text/javascript">
function getMoreRecru(pnum,openid) {
	var ajxurl = "{php echo $this->createMobileUrl('codeajax')}&pnum="+pnum+"&openid="+openid;
	$.ajax({
		type: "GET",
		url: ajxurl,
		dataType: 'html',
		success: function(data) {
			$("#prodibu").after(data);
		},
		error:function(){
			tip("数据加载失败,请重试！",true);
		}
	});
}
$(document).on('click','#close', function () {
    $(".pro-mask").remove();
    $(".w-msgbox").remove();
});
$(document).on('click','#confirmbut', function () {
	$(".pro-mask").remove();
    $(".w-msgbox").remove();
});
</script>
<!-- ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓购买记录信息嵌入模块开始↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓ -->
<script type="text/html" id="customerlist">
	{{# for(var i = 0, len = d.result.length; i < len; i++){ }}
	<li id="pro-view-5">
		<div class="f-clear">
			<div class="avatar"><a href="{php echo $this->createMobileUrl('otherpersonal')}&openid={{ d.result[i].openid }}"><img width="35" height="35" src="{{ d.result[i].avatar }}"></a></div>
			<div class="text">
				<p class="f-breakword">
					<a href="{php echo $this->createMobileUrl('otherpersonal')}&openid={{ d.result[i].openid }}">{{ d.result[i].nickname }}   </a>
					{{# if(d.result[i].ip != ''){ }}
					<span class="address">( IP:{{ d.result[i].ip }}  {{ d.result[i].ipaddress }})</span>
					{{# } }}
				</p>
				<p><span class="num">参与了<span class="txt-red">{{ d.result[i].num }}</span>人次</span> {{ d.result[i].createtime }}</p>
			</div>
		</div> 
	</li>
	{{# } }}
</script>
<!-- ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑购买记录信息嵌入模块结束↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑ -->
<script type="text/javascript">
   //检测刷新购买记录
	var flag_customer = 0;
	var page_customer = 0;
	var op_customer = 'customer';
	
	//判断div是否在可视区域
	  $(document).ready(function () {
            $(window).scroll(function () {
                var a = document.getElementById("refresh").offsetTop;
                if (a >= $(window).scrollTop() && a < ($(window).scrollTop()+$(window).height())&& flag_customer==0) {
                    document.getElementById('refresh').innerHTML='<b></b>让数据飞一会～';
					flag_customer = 1;
					down_load();	
                }
            });
        });
	//下拉加载数据
	function down_load(){
		//传值验证返回	
		var customerAjaxUrl = "{php echo $this->createMobileUrl('detail')}"+"&op="+ op_customer +"&page="+ page_customer + "&period_number=" + '{$period['period_number']}';
		$.ajax({
			type: "POST",
			url: customerAjaxUrl,
			dataType: 'json',
			beforeSend: function(XMLHttpRequest) {},
			success: function(data) {
				if (data.result.length > 0) {
					var gettpl = document.getElementById('customerlist').innerHTML;
					laytpl(gettpl).render(data, function(html){
					    $("#dataList").append(html);
					   document.getElementById('refresh').innerHTML='上拉、试试';		//关闭加载动态
					   flag_customer = 0;		//刷新数据完成
					   page_customer++;			//更新加载页数
					});
				} else {
					document.getElementById('refresh').innerHTML='数据、走到了尽头...';
					flag_customer = 1;		//刷新数据完成
				}
			},
			error: function() {
				$('.error').show();
			}
		});
	}
</script>
</html>